<template>
  <div class="subject">
    <span>{{row.left}}</span>
    <span>+</span>
    <span>{{row.right}}</span>
    <span>=</span>
    <input type="number" v-model.number="result" />
    <button @click="fn">提交</button>
  </div>
</template>

<script>
export default {
    props:{
        row:{
            type:Object,
            required:true
        }
    },
    data(){
        return {
            result:null
        }
    },
    methods:{
        fn(){
            if(this.result){
                this.$emit('dealresult',this.result)
            }else{
                alert('请输入答案')
            }
        }
    }
};
</script>

<style scoped>
.subject {
  margin: 5px;
  padding: 5px;
  font-size: 20px;
}
.subject span {
  display: inline-block;
  text-align: center;
  width: 20px;
}
.subject input {
  width: 50px;
  height: 20px;
}
</style>